package com.iot08.api.service;

import com.iot08.api.response.VipPromptInfoResp;
import com.iot08.api.vo.request.AddVipPromptInfoReqVo;
import com.iot08.common.entity.app.VipPromptInfo;
import com.iot08.common.service.base.BaseAdminService;
import com.iot08.common.utils.response.ResponseMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author cwj
 * @description
 * @date 2024/12/29 9:46
 **/
@Slf4j
@Service
public class VipPromptInfoService extends BaseAdminService<VipPromptInfo> {

    /**
     * @description 添加VIP提示信息
     * @author cwj
     * @param [vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/12/29 15:12
     **/
    public ResponseMap addVipPromptInfo(AddVipPromptInfoReqVo vo){
        VipPromptInfo vipPromptInfo = new VipPromptInfo();
        //Date date = DateUtil.getDate(new Date());
        vipPromptInfo.setPrompt(vo.getPrompt());
        vipPromptInfo.setDesc(vo.getDesc());
        vipPromptInfo.setCreateTime(new Date());
        vipPromptInfo.setUpdateTime(new Date());
        this.save(vipPromptInfo);
        return ResponseMap.success();
    }
    
    /**
     * @description 查询温馨提示信息
     * @author cwj
     * @param []
     * @return java.util.List<com.iot08.api.response.VipPromptInfoResp>
     * @date @time 2024/12/29 15:52
     **/
    public List<VipPromptInfoResp> queryVipPromptInfo(){
        return mongoTemplate.findAll(VipPromptInfoResp.class,"vip_member_prompt_info");
    }
}
